package com.zonekey.model;

import com.zonekey.model.BaseObject;

import org.compass.annotations.Searchable;
import org.compass.annotations.SearchableComponent;
import org.compass.annotations.SearchableId;
import org.compass.annotations.SearchableProperty;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.Table;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;

import javax.xml.bind.annotation.XmlRootElement;

import java.io.Serializable;

@Entity
@Table(name="employee",catalog="cms2")
@Searchable
@XmlRootElement
public class Employee extends BaseObject implements Serializable {
    private Long id;
    private String code;
    private String dept;
    private String name;
    private String status;
    private String telephone;
    private String title;

    @Id @GeneratedValue(strategy=IDENTITY) @SearchableId    
    public Long getId() {
        return this.id;
    }
    
    public void setId(Long id) {
        this.id = id;
    }
    
    @Column(name="code", nullable=false, length=10)
    @SearchableProperty
    public String getCode() {
        return this.code;
    }
    
    public void setCode(String code) {
        this.code = code;
    }
    
    @Column(name="dept", nullable=false, length=50)
    @SearchableProperty
    public String getDept() {
        return this.dept;
    }
    
    public void setDept(String dept) {
        this.dept = dept;
    }
    
    @Column(name="name", nullable=false, length=20)
    @SearchableProperty
    public String getName() {
        return this.name;
    }
    
    public void setName(String name) {
        this.name = name;
    }
    
    @Column(name="status", nullable=false, length=10)
    @SearchableProperty
    public String getStatus() {
        return this.status;
    }
    
    public void setStatus(String status) {
        this.status = status;
    }
    
    @Column(name="telephone", length=20)
    @SearchableProperty
    public String getTelephone() {
        return this.telephone;
    }
    
    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }
    
    @Column(name="title", nullable=false, length=50)
    @SearchableProperty
    public String getTitle() {
        return this.title;
    }
    
    public void setTitle(String title) {
        this.title = title;
    }

    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Employee pojo = (Employee) o;

        if (code != null ? !code.equals(pojo.code) : pojo.code != null) return false;
        if (dept != null ? !dept.equals(pojo.dept) : pojo.dept != null) return false;
        if (name != null ? !name.equals(pojo.name) : pojo.name != null) return false;
        if (status != null ? !status.equals(pojo.status) : pojo.status != null) return false;
        if (telephone != null ? !telephone.equals(pojo.telephone) : pojo.telephone != null) return false;
        if (title != null ? !title.equals(pojo.title) : pojo.title != null) return false;

        return true;
    }

    public int hashCode() {
        int result = 0;
        result = (code != null ? code.hashCode() : 0);
        result = 31 * result + (dept != null ? dept.hashCode() : 0);
        result = 31 * result + (name != null ? name.hashCode() : 0);
        result = 31 * result + (status != null ? status.hashCode() : 0);
        result = 31 * result + (telephone != null ? telephone.hashCode() : 0);
        result = 31 * result + (title != null ? title.hashCode() : 0);

        return result;
    }

    public String toString() {
        StringBuffer sb = new StringBuffer(getClass().getSimpleName());

        sb.append(" [");
        sb.append("id").append("='").append(getId()).append("', ");
        sb.append("code").append("='").append(getCode()).append("', ");
        sb.append("dept").append("='").append(getDept()).append("', ");
        sb.append("name").append("='").append(getName()).append("', ");
        sb.append("status").append("='").append(getStatus()).append("', ");
        sb.append("telephone").append("='").append(getTelephone()).append("', ");
        sb.append("title").append("='").append(getTitle()).append("'");
        sb.append("]");
      
        return sb.toString();
    }

}
